import request from '@/utils/request'
import type{GetAttrListApiParams,AttrList,SaveAttrApiParams} from './model/attrModel'

enum Api {
    getAttrList = '/admin/product/attrInfoList',
    saveAttr = '/admin/product/saveAttrInfo',
    removeAttr = "/admin/product/deleteAttr",
}

// 获取属性列表
export const getAttrListApi = (({category1Id,category2Id,category3Id}:GetAttrListApiParams)=>{
    return request.get<null,AttrList>(`${Api.getAttrList}/${category1Id}/${category2Id}/${category3Id}`)
})

// 添加属性
export const saveAttrApi = (data:SaveAttrApiParams) => {
    return request.post<any,null>(Api.saveAttr,data)
}

// 删除属性
export const removeAttrApi = (id: number) => {
    return request.delete<any, null>(`${Api.removeAttr}/${id}`);
  };